package work04game;

import java.util.Random;

public class Maze {
    String[][] maze = new String[8][8];

    public Maze() {
        generateMaze();
    }

    private void generateMaze(){
        Random rand = new Random();
        for(int i=0; i<8; i++){
            for(int j=0; j<8; j++){
                int GenerateCount = 0;
                GenerateCount = rand.nextInt(14);
                if(GenerateCount <= 1){
                    maze[i][j] = "墙";
                }
                else if(GenerateCount <= 4){
                    maze[i][j] = "怪";
                }
                else if(GenerateCount <= 7){
                    maze[i][j] = "药";
                }
                else if(GenerateCount <= 10){
                    maze[i][j] = "盾";
                }
                else{
                    maze[i][j] = "剑";
                }
            }
        }
        maze[0][0] = "空";
    }
    public void printMaze(Player player) {
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 8; j++) {
                if (player.getX() == i && player.getY() == j) {
                    System.out.print("你");
                }else{
                    System.out.print(maze[i][j]);
                }
            }
            System.out.println();
        }
    }
    public String getCell(int x, int y) {
        return maze[x][y];
    }

    public void setCell(int newX, int newY, String c) {
        maze[newX][newY] = c;
    }
}
